#include "StdAfx.h"

#define MYLIB_API_EXPORT
#include "KernelConverter.h"

//initialize the static member
std::auto_ptr<CKernelConverter> CKernelConverter::_instance(0);

CKernelConverter::CKernelConverter(void)
{
}


CKernelConverter::~CKernelConverter(void)
{
}

bool CKernelConverter::EK_to_IK(EK_Poly_3* input, IK_Poly_3* output)
{
	if (!output)
	{
		return false;
	}
	//
	CKernelRebuilder<IK, EK, IK_Poly_3::HalfedgeDS> builder(input);
	//call the function object of the builder
	output->delegate(builder);
	if (!output->is_valid())
	{
		return false;
	}
	return true;
}

bool CKernelConverter::IK_to_EK(IK_Poly_3* input, EK_Poly_3* output)
{
	if (!output)
	{
		return false;
	}
	//
	CKernelRebuilder<EK, IK, EK_Poly_3::HalfedgeDS> builder(input);
	//call the function object of the builder
	output->delegate(builder);
	if (!output->is_valid())
	{
		return false;
	}
	return true;
}
